package com.jt.safe.ui.teacher.activity

import androidx.core.content.ContextCompat
import com.jt.safe.R
import com.jt.safe.base.BaseActivity
import com.jt.safe.ui.teacher.fragment.TeacherMessageFragment
import com.jt.safe.ui.teacher.fragment.TeacherVideoFragment
import com.jt.safe.viewmodel.NullViewModel
import kotlinx.android.synthetic.main.activity_teacher_main.*

class TeacherMainActivity : BaseActivity<NullViewModel>() {

    override val layoutId: Int
        get() = R.layout.activity_teacher_main

    override fun initView() {
        val newInstance = TeacherVideoFragment.newInstance()
        val newInstance1 = TeacherMessageFragment.newInstance()
        val beginTransaction = supportFragmentManager.beginTransaction()

        beginTransaction.add(R.id.fm, newInstance)
        beginTransaction.add(R.id.fm, newInstance1)
        beginTransaction.hide(newInstance1)
        beginTransaction.commitAllowingStateLoss()

        rl1.setOnClickListener {
            val beginTransaction1 = supportFragmentManager.beginTransaction()
            beginTransaction1.show(newInstance)
            beginTransaction1.hide(newInstance1)
            beginTransaction1.commitAllowingStateLoss()

            iv1.setImageResource(R.mipmap.parent_video_y)
            tv1.setTextColor(ContextCompat.getColor(this, R.color.theme))
            iv4.setImageResource(R.mipmap.parent_message_n)
            tv4.setTextColor(ContextCompat.getColor(this, R.color.tv))
        }
        rl4.setOnClickListener {
            val beginTransaction1 = supportFragmentManager.beginTransaction()
            beginTransaction1.hide(newInstance)
            beginTransaction1.show(newInstance1)
            beginTransaction1.commitAllowingStateLoss()

            iv1.setImageResource(R.mipmap.parent_video_n)
            tv1.setTextColor(ContextCompat.getColor(this, R.color.tv))
            iv4.setImageResource(R.mipmap.parent_message_y)
            tv4.setTextColor(ContextCompat.getColor(this, R.color.theme))
        }
    }

    override fun createObserver() {

    }
}
